package com.tanhua.commons.config;

import com.tanhua.commons.properties.*;
import com.tanhua.commons.templates.*;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
//指定某类生成bean
@EnableConfigurationProperties({SmsProperties.class, OssProperties.class,AipFaceProperties.class,HuanXinProperties.class, HuaWeiUGCProperties.class})
public class TanhuaConfiguration {

    //将返回值变成bean放到spring容器中
    @Bean
    public SmsTemplate smsTemplate(SmsProperties smsProperties){
        SmsTemplate template = new SmsTemplate(smsProperties);
        return template;
    }

    @Bean
    public OssTemplate ossTemplate(OssProperties ossProperties){
        OssTemplate ossTemplate = new OssTemplate(ossProperties);
        return ossTemplate;
    }

    @Bean
    public AipFaceTemplate aipFaceTemplate(AipFaceProperties aipFaceProperties){
        AipFaceTemplate aipFaceTemplate = new AipFaceTemplate(aipFaceProperties);
        return aipFaceTemplate;
    }

    @Bean
    public HuanXinTemplate huanXinTemplate(HuanXinProperties huanXinProperties){
        HuanXinTemplate huanXinTemplate = new HuanXinTemplate(huanXinProperties);
        return huanXinTemplate;
    }

    @Bean
    public HuaWeiUGCTemplate huaWeiUGCTemplate(HuaWeiUGCProperties huaWeiUGCProperties){
        HuaWeiUGCTemplate huaWeiUGCTemplate = new HuaWeiUGCTemplate(huaWeiUGCProperties);
        return huaWeiUGCTemplate;
    }

}
